// /api/Official/User/GetAuth

import { serviceGet, servicePost } from "@/axios/index";
import { IGetAuth, IuserInfo } from "./types";

/** 获取用户信息 */
export const GetUserInfoApi = (params?: any) => {
  return serviceGet<IuserInfo>({
    url: "/api/Official/User/GetUserInfo",
    params,
  });
};

/** 获取菜单 */
export const getAsyncRoutes = () => {
  return serviceGet({
    url: "/api/wwx/User/CurrentInfo",
    // params: { clientType: 2 }
  });
};

// /** 获取认证地址 */
// export const wwxGetOAuthUrl = (params: { redirectUrl: string }) => {
//   return serviceGet({
//     url: "/api/wwx/Auth/GetOAuthUrl",
//     params
//   });
// };

/** 登录根据Code */
export const wwxLoginCode = (data: { code: string }) => {
  return servicePost({
    url: "/api/wwx/Auth/LoginCode",
    data,
  });
};

/**浏览器端调试登录 */ 
export const bLoginCode = (data: { account: string; password: string }) => {
  return servicePost({
    url: "/api/mgr/Auth/LoginMobile",
    data,
  });
};

/** Auth-GetJSSDKConfigSignature */
export const getJSSDKConfigSignatureApi = (params: { url: string }) => {
  return serviceGet<{
    appId: string;
    timestamp: string;
    nonceStr: string;
    signature: string;
  }>({
    url: "/api/wwx/Auth/GetJSSDKConfigSignature",
    params,
  });
};

/** 扫码登录-确认登录 */
export const ScanLoginConfirmLoginApi = (data: { code: string }) => {
  return servicePost({
    url: "/api/wwx/ScanLogin/ConfirmLogin",
    data,
  });
};
